<template>
	<view>
		<u-sticky :customNavHeight="0" bgColor="white" zIndex="1" bg-color="white">
			<u-tabs
				:activeStyle="{ color: $main_color }"
				:itemStyle="itemStyle"
				@change="change"
				:current="state.current"
				:lineColor="$main_color"
				:list="Tabs"
				scrollable
			></u-tabs>
		</u-sticky>
		<a-list-layout ref="layout" :params="queryParams" #default="data" request_url="/order/orderList">
			<m-list-team @reset="layout.resetPage()" open_button v-for="(item, index) in data.lists" :item="item" :key="index"></m-list-team>
		</a-list-layout>
		<a-tabbar path="pages/tabbar/order"></a-tabbar>
	</view>
</template>
<script setup>
import { ref, reactive, nextTick } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
/* 上拉加载开始*/
const layout = ref(null);
const queryParams = reactive({
	state: 0 //0已结单1已完成
});
onLoad(async (options) => {
	await nextTick();
	layout.value.getLists();
});
/* 上拉加载结束*/
const Tabs = [
	{
		name: '待审核',
		state: 0
	},
	{
		name: '已接单',
		state: 3
	},
	{
		name: '已完成',
		state: 1
	},
	{
		name: '已结算',
		state: 2
	},
	{
		name: '已拒绝',
		state: 4
	},
];
const itemStyle = {
	width: '25%',
	height: '44px',
	padding: '0 15rpx'
};
const state = reactive({
	current: 0
});
const change = (e) => {
	queryParams.state = e.state;
	uni.$u.debounce(layout.value.resetPage, 500, true);
};
</script>
